// package: learn-go
// filename: main
// author: Administrator@gmail.com
// time: 2023/8/17 16:40
package main

import "fmt"

type Persone struct {
	Name string
	Age  int
}

type Student struct {
	Persone
	//Age   int
	Grade int
}

func main() {
	s := Student{
		Persone: Persone{
			Name: "Tom",
			Age:  18,
		},
		//Age:   12,
		Grade: 1,
	}

	age := s.Age
	// 当 Student 中没有 Age 字段时，就会访问 s.Persone 中的 Age 字段
	fmt.Println(age) // 18

	fmt.Println(s.Persone.Age) // 18
}
